

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Edit Picture</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Picture List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New Picture</g:link></span>
        </div>
        <div class="body">
            <h1>Edit Picture</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${picture}">
            <div class="errors">
                <g:renderErrors bean="${picture}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <input type="hidden" name="id" value="${picture?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="caption">Caption:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'caption','errors')}">
                                    <input type="text" maxlength="40" id="caption" name="caption" value="${fieldValue(bean:picture,field:'caption')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description">Description:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'description','errors')}">
                                    <input type="text" id="description" name="description" value="${fieldValue(bean:picture,field:'description')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="contentType">Content Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'contentType','errors')}">
                                    <input type="text" id="contentType" name="contentType" value="${fieldValue(bean:picture,field:'contentType')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dateCreated">Date Created:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'dateCreated','errors')}">
                                    <g:datePicker name="dateCreated" value="${picture?.dateCreated}" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="height">Height:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'height','errors')}">
                                    <input type="text" id="height" name="height" value="${fieldValue(bean:picture,field:'height')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="images">Images:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'images','errors')}">
                                    
<ul>
<g:each var="i" in="${picture?.images?}">
    <li><g:link controller="image" action="show" id="${i.id}">${i?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>
<g:link controller="image" params="['picture.id':picture?.id]" action="create">Add Image</g:link>

                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="lastUpdated">Last Updated:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'lastUpdated','errors')}">
                                    <g:datePicker name="lastUpdated" value="${picture?.lastUpdated}" ></g:datePicker>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="listing">Listing:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'listing','errors')}">
                                    <g:select optionKey="id" from="${Listing.list()}" name="listing.id" value="${picture?.listing?.id}" ></g:select>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="width">Width:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'width','errors')}">
                                    <input type="text" id="width" name="width" value="${fieldValue(bean:picture,field:'width')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="confirmDelete">Confirm Delete:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'confirmDelete','errors')}">
                                    <g:checkBox name="confirmDelete" value="${picture?.confirmDelete}"></g:checkBox>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="file">File:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'file','errors')}">
                                    <input type="text" name="file" id="file" value="${fieldValue(bean:picture,field:'file')}" />
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="operation">Operation:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:picture,field:'operation','errors')}">
                                    <input type="text" id="operation" name="operation" value="${fieldValue(bean:picture,field:'operation')}" />
                                </td>
                            </tr> 
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
